import request from "./utils/request";
import { API_CONFIG } from "./config/api.config";

const goodsApi = {
  // 获取商品
  list() {
    return request({
      url: API_CONFIG.GOODS.LIST,
      method: "get",
    });
  },

  /**
   * 购买接口
   * @param {*} data
   * @returns
   */
  create(data) {
    return request({
      url: API_CONFIG.ORDER.CREATE,
      method: "post",
      data,
    });
  },

  /**
   *
   * @returns 手续费列表
   */
  feeList() {
    return request({
      url: API_CONFIG.GOODS.FEE_LIST,
      method: "get",
    });
  },

  /**
   * 转赠
   * @param {data} data
   * @returns
   */
  transfer(data) {
    return request({
      url: API_CONFIG.USER.TRANSFER,
      method: "put",
      data: data,
    });
  },

  banner() {
    return request({
      url: API_CONFIG.BANNER.LIST,
      method: "get",
    });
  },
};

export default goodsApi;
